"""
Author        yongfa
Date          2023-08-31 03:37:19
LastEditTime  2023-08-31 06:01:38
LastEditors   yongfa
Description   参数校验
"""

from flask_restx import reqparse, inputs

from app.extensions.utils.parameters import page_params

get_list_params = page_params.copy()
get_list_params.add_argument('name', type=str, location='args', help='名称')


create_params = reqparse.RequestParser()
create_params.add_argument('name', type=str, required=True, location='json', trim=True, help='名称')
create_params.add_argument('code', type=str, location='json', trim=True, help='编码')
create_params.add_argument('level', type=int, location='json', trim=True, help='等级')
create_params.add_argument('status', type=inputs.boolean, location='json', trim=True, help='状态')
create_params.add_argument('remark', type=str, location='json', trim=True, help='备注')

update_params = create_params.copy()
update_params.replace_argument('name', type=str, location='json', trim=True, help='名称')


# access_key
get_list_access_params = page_params.copy()
get_list_access_params.add_argument('company_id', type=int, location='args', help='公司ID')

create_access_params = reqparse.RequestParser()
create_access_params.add_argument('company_id', type=int, required=True, location='json', trim=True, help='公司ID')

update_access_params = reqparse.RequestParser()
update_access_params.add_argument('status', type=inputs.boolean, location='json', trim=True, help='状态')

set_params = {
    'get_list_params': get_list_params,
    'create_params': create_params,
    'update_params': update_params,
    'get_list_access_params': get_list_access_params,
    'create_access_params': create_access_params,
    'update_access_params': update_access_params
}
